package com.gears_software.sxdc.dccx.data.finder;

import com.gears_software.sxdc.dccx.data.finder.util.GearsAuthInterceptor;
import com.gears_software.sxdc.dccx.data.finder.util.GearsResponseErrorHandler;
import com.gears_software.sxdc.dccx.data.model.MemberModel;
import com.gears_software.sxdc.dccx.data.model.ResultModel;
import com.gears_software.sxdc.dccx.data.model.TokenModel;
import com.gears_software.sxdc.dccx.data.model.request.RMemberAvatarModel;
import com.gears_software.sxdc.dccx.data.model.request.RMemberLoginModel;
import com.gears_software.sxdc.dccx.data.model.request.RNameAuthenticationModel;
import com.gears_software.sxdc.dccx.data.model.request.ROwnerCertificationModel;
import com.gears_software.sxdc.dccx.data.model.request.RUpdateMemberModel;

import org.androidannotations.rest.spring.annotations.Body;
import org.androidannotations.rest.spring.annotations.Get;
import org.androidannotations.rest.spring.annotations.Path;
import org.androidannotations.rest.spring.annotations.Post;
import org.androidannotations.rest.spring.annotations.Put;
import org.androidannotations.rest.spring.annotations.Rest;
import org.androidannotations.rest.spring.api.RestClientErrorHandling;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;

/**
 * Created by chezhenzhen on 2017/8/2.
 * 用户相关接口
 */

@Rest(rootUrl = RequestUrl.ROOT, converters = {MappingJackson2HttpMessageConverter.class}, interceptors = GearsAuthInterceptor.class)
public interface IMemberFinder extends RestClientErrorHandling {

    /**
     * 用户登录注册
     *
     * @param loginModel
     */
    @Post("/jwt/token/login")
    ResultModel<TokenModel> loginAndRegister(@Body RMemberLoginModel loginModel);

    /**
     * 获取短信验证码
     *
     * @param telephone
     */
    @Get("/jwt/token/code?telephone={telephone}")
    ResultModel<Object> getTelephoneCode(@Path String telephone);

    /**
     * 修改当前用户头像
     *
     * @param model
     */
    @Put("/api/member/avatar")
    ResultModel<String> updaeAvatar(@Body RMemberAvatarModel model);

    /**
     * 获取当前用户信息
     */
    @Get("/api/member/get")
    ResultModel<MemberModel> getMember();

    /**
     * 用户退出登录
     */
    @Get("/api/member/logout")
    ResultModel<String> logout();

    /**
     * 实名认证
     *
     * @param model
     */
    @Put("/api/member/auth")
    ResultModel<String> nameAuthentication(@Body RNameAuthenticationModel model);

    /**
     * 车主认证(认证用户信息)
     *
     * @param model
     */
    @Put("/api/member/cert")
    ResultModel<String> ownerCertification(@Body ROwnerCertificationModel model);

    /**
     * 修改用户昵称性别
     */
    @Put("/api/member/update_base")
    ResultModel<String> updateMemberInfo(@Body RUpdateMemberModel memberModel);
}
